package com.js.springbootmongodb.service.Impl;

import com.js.springbootmongodb.entity.Article;
import com.js.springbootmongodb.mapper.ArticleMapper;
import com.js.springbootmongodb.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public List<Article> selectAllArticle() {
        List<Article> list = articleMapper.findAll();
        return list;
    }

    @Override
    public Optional<Article> selectById(String articleid) {
        Optional<Article> article = articleMapper.findById(articleid);
        return article;
    }


}
